// A response wrapper to be used when we want our own custom servlet output stream
package by.ad.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Locale;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

public class HttpServletResponseCatcher
  extends HttpServletResponseWrapper
{
  public HttpServletResponseCatcher(HttpServletResponse response) {
    super(response);
  }
  
  @Override public PrintWriter getWriter() throws IOException {
    return writer;
  }
  
  @Override public ServletOutputStream getOutputStream() throws IOException {
    return this.out;
  }
  
  @Override public void reset() {}
  @Override public void resetBuffer() {}
  @Override public void flushBuffer() {}
  
  @Override public void setLocale(final Locale var1) {}
  @Override public void setContentType(final String var1) {}
  @Override public void setContentLength(final int var1) {}
  @Override public void setCharacterEncoding(final String var1) {}
  @Override public void setBufferSize(final int var1) {}
  @Override public void setStatus(final int var1, final String var2) {}
  @Override public void setStatus(final int var1) {}
  @Override public void setIntHeader(final String var1, final int var2) {}
  @Override public void setHeader(final String var1, final String var2) {}
  @Override public void setDateHeader(final String var1, final long var2) {}
  @Override public void sendRedirect(final String var1) throws IOException {}
  @Override public void sendError(final int var1, final String var2) throws IOException {}
  @Override public void sendError(final int var1) throws IOException {}
  @Override public void addIntHeader(final String var1, final int var2) {}
  @Override public void addHeader(final String var1, final String var2) {}
  @Override public void addDateHeader(final String var1, final long var2) {}
  @Override public void addCookie(final Cookie var1) {}
  
  private final ServletOutputStream out = new StringOutputStream();
  private final PrintWriter writer = new PrintWriter(out);
}
